﻿namespace Aldart.WebSockets.Server
{
    using System;
    using System.Net.Sockets;

    /// <summary>
    /// Enumeration describing the possible results of a handshake.
    /// </summary>
    public enum HandshakeResult
    {
        /// <summary>
        /// Indicates that the handshake has been successful.
        /// </summary>
        Success,

        /// <summary>
        /// Indicates that the handshake has failed, either because the client has sent incorrect data or because
        /// the connection has been disconnected.
        /// </summary>
        Failure
    }

    /// <summary>
    /// Argument class for the HandshakeComplete Event
    /// </summary>
    public class HandshakeCompleteEventArgs : EventArgs
    {
        /// <summary>
        /// Field containing the client the handshake was performed with.
        /// </summary>
        private TcpClient client;

        /// <summary>
        /// Field containing the result of the handshake.
        /// </summary>
        private HandshakeResult result;

        /// <summary>
        /// Gets or sets the client object of the handshake.
        /// </summary>
        public TcpClient Client {
            get { return this.client; }
            set { this.client = value; }
        }

        /// <summary>
        /// Gets or sets the result of the handshake.
        /// </summary>
        public HandshakeResult Result {
            get { return this.result; }
            set { this.result = value; }
        }
    }
}
